package Editor_Memento_19;

public class EditorApplication {
    public static void main(String[] args) {

        EditorHistory history = new EditorHistory();
        Editor editor = new Editor();

        editor.setContent("Hello, World!");
        history.save(editor.save());
        System.out.println("当前文本：" + editor.getContent());

        editor.setContent("Goodbye, World!");
        editor.save();
        System.out.println("当前文本：" + editor.getContent());

        editor.restore(history.getLastMemento());
        System.out.println("恢复到上一个状态：" + editor.getContent());

    }
}
